package 蓝桥真题;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.Arrays;

public class 求和 {
       static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
       final static int N=200010;
       static int a[]=new int[N];
       public static void main(String[] args) throws  IOException {
		      int n=Integer.parseInt(br.readLine());
		      String[]ss=br.readLine().split(" ");
		      long sum=0;
		      for(int i=0;i<n;i++){
		    	  int x=Integer.parseInt(ss[i]);
		    	  a[i]=x;
		    	  sum+=x;
		      }
		      long res=0;
		      for(int i=0;i<n;i++){
		    	  res+=a[i]*(sum-a[i]);
		    	  sum-=a[i];
		      }
		      System.out.print(res);
	}
}
   